<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
#map_div {
	border: 1px solid black;
	width: 500px;
	height: 800px;
}
</style>
<script src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script>
var title;
var latlng;
var div;
function getId(id){ return document.getElementById(id)};

	window.onload=function(){
		div = document.getElementById("map_div");
		// 표시할 위도경도를 객체 생성
		latlng = new google.maps.LatLng(37.5976634, 127.0652653);
		viewMap();
		
		getId('btnCompany').onclick = function(){
			latlng = new google.maps.LatLng(26.6860390, -80.6678960);
			title = "Second Company";
			viewMap();
		}
		getId('btnHouse').onclick = function(){
			latlng = new google.maps.LatLng(35.6894870, 139.6917060);
			title = "Second House";
			viewMap();
		}
	}
	
	function viewMap(){
		// 지도를 div 에 표시
		var gmap = new google.maps.Map(div, {
			zoom:10,
			center:latlng,
			mapTypeId:google.maps.MapTypeId.ROADMAP
		});
		
		// 지도 위에 마커표시
		var market = new google.maps.Marker({
			position: latlng,
			map:gmap,
			title:"류지훈의 그곳?!"
		});
		
	}
</script>
</head>
<body>
<div id="map_div"><p/>
	
</div>
<input type="button" id="btnHome" value="Our Home">
<input type="button" id="btnCompany" value="Lover 1">
<input type="button" id="btnHouse" value="Lover 2">
</body>
</html>